package extendsdemo;

/**
 * Created by Veronica on 2017/3/31.
 */
/*2. 继承的限制
        2.1 在Java中只允许单继承
        2.2 子类不能直接访问父类的私有成员*/
class People{
    private int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
class Worker extends People{
    public void tell(){
        System.out.println(getAge());
}
//class PetWorker extends Worker{
//    public void tell(){
//        System.out.println(age);
//    }

}

public class ExtendsDemo02 {
    public static void main(String[] args) {
        Worker w =new Worker();
        w.setAge(100);
        w.tell();
    }
}
